var xmlHttp
var p_id
var update_location

function updatePlayer(player_id, p_uid, p_row, p_rp1, p_rp2, p_num, script_location)
{

	p_id = player_id;

	p_level = document.getElementById('level' + p_id).value;
	p_name = document.getElementById('name' + p_id).value;
	p_class = document.getElementById('class' + p_id).value;
	p_race = document.getElementById('race' + p_id).value;
	p_team = document.getElementById('team' + p_id).value;
	update_location = script_location

	var url="admin.php?action=up&p_id=" + p_id + "&p_name=" + p_name + "&p_class=" + p_class + "&p_race=" + p_race + "&p_team=" + p_team + "&p_level=" + p_level + "&p_uid="  + p_uid + "&p_row="  + p_row + "&p_rp2="  + p_rp1 + "&p_rp2=" + p_rp2  + "&p_num=" + p_num + "&location=" + script_location

	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		if (update_location == 1)
		{
			document.getElementById('standing' + p_id).innerHTML = xmlHttp.responseText;
		} else
		{
			document.getElementById('panel' + p_id).innerHTML = xmlHttp.responseText;
		}

	}
}

function GetXmlHttpObject(handler)
{
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("MSIE")>=0)
	{
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
	{
		strName="Microsoft.XMLHTTP"
	}
	try
	{
		objXmlHttp=new ActiveXObject(strName)
		objXmlHttp.onreadystatechange=handler
		return objXmlHttp
	}
	catch(e)
	{
		alert("Error. Scripting for ActiveX might be disabled")
		return
	}
	}
		if (navigator.userAgent.indexOf("Mozilla")>=0 || navigator.userAgent.indexOf("Opera")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
		return objXmlHttp
	}
}